<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/CustomCommand.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Class to validate a credential
	*/
	class CommandChangeEmployee extends CustomCommand {
		/*
		* Constructor of the class
		*/
     public function __construct($pkIdNumber, $firstName, $secondName, $firstLastName, 
			$secondLastName, $emailAddress) {
			$this -> pkIdNumber = $pkIdNumber;
			$this -> firstName = $firstName;
			$this -> secondName = $secondName;
			$this -> firstLastName= $firstLastName;
			$this -> secondLastName = $secondLastName;
			$this -> emailAddress = $emailAddress;
		
		
		}
		
		/*
		* Method to execute to validate the credential
		*/
	public function execute() {
			//Ir contra el DAO con este query

			$daoFactory= DaoFactory:: getMySqlDaoFactory();
			$iuad= $daoFactory-> getMySqlEmployeeAccessDao();			
			$success=$iuad->changeEmployee($pkIdNumber, $firstName, $secondName, $firstLastName, 
			$secondLastName, $emailAddress);
	
			
			//Si existe la credencial el resultado es true
			$this -> result = $success;
		}
	}
?>